Skip to content

chore: fix pre-existing typecheck errors + add CI typecheck gate#13

Merged
toolpathguy merged 1 commit into
mainfrom
chore/fix-typecheck-errors
Jun 15, 2026
Merged

chore: fix pre-existing typecheck errors + add CI typecheck gate#13
toolpathguy merged 1 commit into
mainfrom
chore/fix-typecheck-errors

Conversation

@toolpathguy

Copy link
Copy Markdown
Owner

Fixes #10

Makes npx nuxi typecheck genuinely clean (78 → 0 errors) and gates it in CI so it can't regress. Spec'd design-first under .kiro/specs/fix-typecheck-errors/.

Two distinct root causes

77 test call-site errors — noUncheckedIndexedAccess (TS2532/TS18048)

Tests index results they construct (so are provably in range) without telling the compiler. Fixed with ! at the index/destructure site — the same convention newer tests already follow. No production source changed; no test assertion weakened, skipped, or deleted.

  • utils/toRegisterRows.test.ts (38)
  • utils/toTransactionInput.test.ts (13)
  • utils/toTransactionInput.property.test.ts (12)
  • utils/roundTrip.property.test.ts (7)
  • utils/toRegisterRows.property.test.ts (6)
  • server/api/__tests__/migration.test.ts (1)

1 page-component error — a real latent bug (TS2322)

AccountRegister emits delete: [index: number] (a plain number), but pages/accounts/[...path].vue's deleteTx was typed { transactionIndex: number } and read .transactionIndex off the number → delete requests sent index: undefined. Fixed deleteTx/editTx to take number (also removes an any). The typecheck flagged a genuine defect, exactly as the issue suspected.

CI gate

New .github/workflows/ci.yml — typecheck-only job (npm cinpx nuxi typecheck) on push/PR to main. No test job yet: the suite has hledger-on-PATH-gated tests whose CI wiring overlaps with #11, left to a follow-up.

Decisions (both confirmed during the spec)

  1. CI scope — typecheck-only here; test job deferred (overlaps chore: audit the test suite (skipped/gated tests, legacy paths, coverage gaps) #11).
  2. Delete-fix regression guard — the typecheck gate itself, not a runtime test. The suite has no component-mount harness and deleteTx isn't exported; reverting the handler reintroduces the exact TS2322 and fails CI. See design.md / R3.4.

Verification

  • npx nuxi typecheck0 errors (was 78), exit 0
  • npx vitest run40 test files pass
  • Diff confined to the 7 source files + ci.yml; no tooling config touched (noUncheckedIndexedAccess stays on; no test excluded), no new any

🤖 Generated with Claude Code

#10)

Resolve all 78 `npx nuxi typecheck` errors so the check can gate CI.

- 77 test call-site errors (noUncheckedIndexedAccess, TS2532/TS18048): add
  `!` at provably-in-range index/destructure sites, matching the convention
  already used by newer tests. No production source or test assertions changed.
- 1 page-component error (TS2322) was a real latent bug: AccountRegister emits
  a plain numeric index, but pages/accounts/[...path].vue's deleteTx was typed
  to receive `{ transactionIndex }` and read `.transactionIndex` off the number,
  sending `index: undefined` on delete. Fix deleteTx/editTx to take `number`
  (also removes an `any`).
- Add .github/workflows/ci.yml: typecheck-only job (npm ci -> nuxi typecheck)
  on push/PR to main. No test job yet (needs hledger on PATH; overlaps #11).

The delete fix is guarded by the typecheck gate itself (reverting the handler
reintroduces the same TS2322) rather than a runtime test — the suite has no
component-mount harness and deleteTx isn't exported.

Verified: nuxi typecheck = 0 errors (was 78); vitest run = 40 files pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@toolpathguy toolpathguy merged commit 341133b into main Jun 15, 2026
1 check passed
@toolpathguy toolpathguy deleted the chore/fix-typecheck-errors branch June 17, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: fix pre-existing typecheck errors (78 errors, mostly noUncheckedIndexedAccess in tests)

1 participant